import React, { useRef } from 'react'
import Test from './Test'
export default function App() {
  const appRef = useRef() //app里面的ref对象
  return (
    <div>
      App
      <button
        onClick={() => {
          // 点击app组件的按钮,然后让Test组件中的input标签获取焦点
          // appRef.current.focus()
          // appRef.current.style.backgroundColor = 'red'
          // console.log(appRef.current)
          appRef.current.xxx()
        }}
      >
        按钮
      </button>
      <hr />
      <Test ref={appRef}></Test>
    </div>
  )
}
